/**
 * Created by Freeman on 2016/7/26.
 */
import {createStore} from 'redux'
import rootReducer from '../reducers'
const configureStore = (preloadedState) => {
    const store = (window.devToolsExtension ? window.devToolsExtension()(createStore) : createStore)(rootReducer, preloadedState);
    if (module.hot) {
        // Enable Webpack hot module replacement for reducers
        module.hot.accept('../reducers', () => {
            const nextReducer = require('../reducers').default
            store.replaceReducer(nextReducer)
        })
    }

    return store
};
export default configureStore;